home *** CD-ROM | disk | FTP | other *** search
- ; 386POWER example program #0.
- ; Install a mouse driver, compile, and run.
- ; When run, use the left mouse button to draw. Any key exits.
- .386p
-
- code32 segment para public use32
- assume cs:code32, ds:code32
-
- include 386power.inc
- include 386video.inc
- include 386file.inc
-
- public _Main
-
- CR equ 0dh
- LF equ 0ah
-
- ; DATA
- ex_text db 'TEST ZERO for 386POWER',CR,LF
- db 'Testing startup, FILE I/0 & Keyboard',CR,LF
- db 'PRESS ESC TO EXIT',0
- lo_mem db 'AVAILABLE DOS MEMORY',0
- hi_mem db 'AVAILABLE EXTENDED MEMORY',0
- fl_mem db 'SIZE OF HELLO.TXT FILE',0
- tt_mem db 'TEXT CONTAINED INTO HELLO.TXT:',0
- man_text db 'RUNNING UNDER ',0
- systypestr db 'VCPI','DPMI'
- hextuff db '0123456789ABCDEF'
- d_text db 8 dup(0)
- fname db 'hello.txt',0
- rkbtext db 'RAW KEYBOARD'
- esctext db 'Press & release ESC to exit '
-
- ; CODE
-
- PutText: ; put ECX chars to screen with attr AH
- push edx
- mov edx,edi
- XPutText:
- lodsb
- cmp al,0
- je CHend
- cmp al,CR
- jne noCR
- mov edi,edx
- jmp nxCH
- noCR: cmp al,LF
- jne noLF
- add edx,160
- add edi,160
- jmp nxCH
- noLF:
- stosw
- nxCH:
- loop XPutText
- CHend:
- pop edx
- ret
-
- ;----------------------
- d2text: ; edx = dword to convert to hex
- push ebx
- push ecx
- push edi
-
- xor ebx,ebx
- mov edi, offset d_text
- mov ecx, 8
- add edi, 7
- std
- txpit:
- mov ebx,edx
- and ebx,0Fh
- mov al,[ebx+hextuff]
- stosb
- shr edx,4
- loop txpit
-
- pop edi
- pop ecx
- pop ebx
- cld
- ret
-
- LargestFree DD 48 dup(0FFFFFFFFh)
-
- ;═════════════════════════════════════════════════════════════════════════════
- _Main: mov al,10h
- mov V86ax,0003 ; text mode 80 columns, 16 colors
- int 33h
-
- sti
- @rlp edi,0b8000h ; get relative pointer to text screen
- mov ecx,(80*25)/2 ; and clear it
- mov eax,00000h
- rep stosd
-
- @rlp edi,0b8000h+(50*2) ; put type of system
- mov esi,offset man_text
- mov ecx,-1
- mov ah,14
- call PutText
- movzx esi,_386Man
- and esi,1 ; all the other bits will be 0, but
- lea esi,[esi*4+systypestr] ; what the hell
- mov ecx,4
- mov ah,15
- call PutText
-
-
- mov edx,_HiMemTop
- sub edx,_HiMemBase
- call d2text
-
- @rlp edi,0b8000h
- mov esi,offset d_text
- mov ecx,8
- mov ah,13
- call PutText
-
- @rlp edi,(0b8000h+18)
- mov esi,offset hi_mem
- mov ecx,-1
- mov ah,13
- call PutText
-
- mov edx,_LoMemTop
- sub edx,_LoMemBase
- call d2text
-
- @rlp edi,(0b8000h+160)
- mov esi,offset d_text
- mov ecx,8
- mov ah,12
- call PutText
-
- @rlp edi,(0b8000h+160+18)
- mov esi,offset lo_mem
- mov ecx,-1
- mov ah,12
- call PutText
-
- cmp _386Man,IS_DPMI
- jne naDPMI
- mov ax,0500h
- mov edi,offset LargestFree
-
- int 31h
- rcl edx,1
- and dl,1
- @rlp edi,(0B8000h+(160*3))
- mov ebx,offset LargestFree
- glop:
- mov ecx,10
- memma:
- push ecx
-
- push edi
-
- call d2text
- mov esi, offset d_text
- mov ecx,8
- mov ah,7
- call PutText
-
- pop edi
-
- add edi,160
- mov edx,[ebx]
- add ebx,4
-
- pop ecx
- loop memma
-
- naDPMI:
- mov esi, offset fname
- call _FLoad
-
- pushad
- mov edx,eax
- call d2text
-
- @rlp edi,(0b8000h+(160*2))
- mov esi,offset d_text
- mov ecx,8
- mov ah,11
- call PutText
-
- @rlp edi,(0b8000h+(160*2)+18)
- mov esi,offset fl_mem
- mov ecx,-1
- mov ah,11
- call PutText
-
- popad
-
- mov ecx,eax
-
- cmp eax,-1
- je noputthis
- mov esi,_HiMemBase
- @rlp edi,(0B8000h+(160*15))
- mov ah,5
- call PutText
-
- @rlp edi,(0b8000h+(160*14))
- mov esi,offset tt_mem
- mov ecx,-1
- mov ah,7
- call PutText
-
- noputthis:
- @rlp edi,(0b8000h+(160*22)+(40*2))
- mov esi,offset ex_text
- mov ecx,-1
- mov ah,10
- call PutText
-
- call _InstallRKB
-
- @rlp edi,(0B8000h+(160*3)+100)
- mov ah,7
- mov ecx,12
- mov esi,offset rkbtext
- call PutText
- @rlp edi,(0B8000h+(160*4)+100)
- mov ah,7
- mov ecx,28
- mov esi,offset esctext
- call PutText
-
- kkey:
- call _WaitKey
- @rlp edi,(0b8000h+(160*5)+120)
- mov esi,offset _RKB
- mov ebx,16
- inlup:
- push edi
- mov ecx,8
- glup:
- lodsb
- mov dx,1720h
- or al,al
- jz zogg
- mov dx,1740h
- zogg: mov [edi],dx
- add edi,2
- loop glup
- pop edi
- add edi,160
- dec ebx
- jne inlup
- mov edi,offset _RKB
- cmp byte ptr [edi+_ESC],02
- je thend
- mov eax,0
- mov ecx,32
- rep stosd
- jmp kkey
- thend:
- @rlp edi,0b8000h
- mov ecx,2000
- mov al,07
- defcolor:
- inc edi
- stosb
- loop defcolor
-
- jmp _Exit
-
-
- code32 ends
- end
-
-